package com.ocom.aiotweb.controller;

import com.ocom.aiotweb.service.MinioService;
import com.ocom.common.constant.AiotUrl;
import com.ocom.common.constant.HumanServiceUrl;
import com.ocom.common.resp.Result;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

//@PreAuthorize("hasRole('ROLE_WEB')")
@Slf4j
@RestController
public class MinioController {
    private final Logger log = LoggerFactory.getLogger(MinioController.class);
    @Autowired
    MinioService minioService;

    /**
     * 文件上传（FileLoad）
     * */
    @PostMapping(AiotUrl.URL_Aiot_FileLoad)
    public Result FileLoad(@RequestPart("file") MultipartFile file){
        return minioService.FileLoad(file);
    }
}
